<!DOCTYPE html>
<#assign base=request.contextPath />
<html>
	<head>
		<meta charset="UTF-8">
		<title>登录</title>
		<link rel="stylesheet" type="text/css" href="${base}/statics/font1/iconfont.css"/>
		<link rel="stylesheet" type="text/css" href="${base}/statics/css1/base-pc.css"/>
		<link rel="stylesheet" type="text/css" href="${base}/statics/css1/xcommon.css"/>
		<link rel="stylesheet" type="text/css" href="${base}/statics/css1/reglogin.css"/>

		<script src="${base}/statics/js1/jquery-1.11.3.min.js"></script>
		<script src="${base}/statics/layer1/layer.js"></script>
		<script src="${base}/statics/js1/jquery.SuperSlide.2.1.js"></script>
		<script src="${base}/statics/js1/base.js"></script>
	</head>
	<body>
		<header>
			<div class="header" style="border-bottom: 2px solid #459df5;">
			<div class="topbar">
			   <div class="top inner ">欢迎您来到亿矿云百科！</div>
			</div>
			<div class="logobar inner inwhite clearfix" >
			<h1 class="logo">
				<a href="/api/first"  target="_blank"><img src="${base}/statics/images1/logo.png"/></a>
			</h1>
			<div class="right clearfix">
				<div class="alr">
					没有账号，请 <a href="/api/users/reg">注册</a>
				</div>
			</div>	
			</div>
			</div>
		</header>
		<div class="loginbox">
			<div class="login inner clearfix">
				<div class="left">
					<img src="${base}/statics/images1/lb.png" alt=""/>
				</div>
				<div class="right">
					<div class="lbox bz">
						<div class="item">
							<i class="iconfont">&#xe603;</i>
							<input id="xingming" type="text" class="txtLogin bz " placeholder="请输入用户名"  />
						</div>
						<div class="item">
							<i class="iconfont">&#xe602;</i>
							<input id="mima" type="password" class="txtLogin bz" placeholder="请输入密码"  />
						</div>
						<div  style="text-align: center; margin:30px auto;">
						   <a class=" subBtn">立即登录</a>
						</div>
						</div>
				</div>
			</div>
		</div>
		<footer>
			<div class="footer">
				<p>Copyright 2011- 2018 山东中煤集体神华科技 Inc All Rights Reserved. 鲁ICP备2125414号-1 </p>
				<p>地址：山东济宁开源路11号 </p>
				<p>客服电话：400-0733-010 Email：service@yike.com</p>
			</div>
	    </footer>
	</body>
    <script>
        $(".subBtn").click(function (){
            var name = $("#xingming").val();
            var reg = /^[a-zA-Z]*$/;
            if(reg.test(name) === false){
                alert("只能输入字母，请重新输入");
                return false
            }
            var mima = $("#mima").val();
            mima = mima.replace(/(^\s*)|(\s*$)/g, '');//去除空格;

            if (mima == '' || mima == undefined || mima == null) {
                //return true;
                alert("请输入密码")
                return false
            }
            $.ajax({
                type: "POST",
                url:"/api/users/login",
                // contentType: "application/json",
                data: {name:name,passw:mima},
                success: function(r){
                    if(r.code == 0){
                        alert('请登录成功！');
                      	setCookie("token",r.token)
                        window.location.href="/api/first";
                    }else{
                        alert(r.msg);
                    }
                }
            });
        });
    </script>
</html>
